//
//  CircleMainVC.m
//  LuQu
//
//  Created by xp on 2017/7/25.
//  Copyright © 2017年 mingthink. All rights reserved.
//

#import "CircleMainVC.h"
#import <JavaScriptCore/JavaScriptCore.h>
@interface CircleMainVC ()
@property (nonatomic, strong) JSContext *jsContext;
@end

@implementation CircleMainVC

- (void)viewDidLoad {
    [super viewDidLoad];
    //[self initWebView];
}
//-(void)initWebView
//{
//    UIWebView *mainWebV=[[UIWebView alloc]initWithFrame:CGRectMake(0, NAVBAR_HEIGH, DEVW, DEVH-NAVBAR_HEIGH-TABBAR_HEIGH)];
//    [self.view addSubview:mainWebV];
//    NSURL *url=[NSURL URLWithString:@"http://www.baidu.com"];
//    NSURLRequest *request=[NSURLRequest requestWithURL:url];
//    [mainWebV loadRequest:request];
//}
//#pragma mark - UIWebViewDelegate
//- (void)webViewDidFinishLoad:(UIWebView *)webView {
//    JSContext *context = [webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
//    // 通过模型调用方法，这种方式更好些。
//    model  = [[JSObjectModel alloc] init];
//    context[@"jxmt"] = model;
//    model.jsContext=context;
//    model.delegate = self;
//
//    context.exceptionHandler = ^(JSContext *context, JSValue *exceptionValue) {
//        context.exception = exceptionValue;
//        NSLog(@"异常信息：%@", exceptionValue);
//    };
//}
//- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
//    if ([message.name isEqualToString:@"selectImageFromPictureLibaryAndUpload"]) {
//          [self selectImage];
//    }
//    if ([message.name isEqualToString:@"scanQRCode"]) {
//        [self scanQRCode];
//    }
//    if ([message.name isEqualToString:@"showToast"]) {
//        [self showToastWithContent:message.body[0]];
//    }
//    if ([message.name isEqualToString:@"saveData"]) {
//        [DataUtil saveDefaultInfo:message.body Key:@"token"];
//    }
//    if ([message.name isEqualToString:@"getData"]) {
//        NSString *token=[DataUtil getDefaultInfo:message.body];
//        NSString *jsStr=[NSString stringWithFormat:@"alert('%@')",token];
//        [_webView evaluateJavaScript:@"alert('kkkk')" completionHandler:^(id hhh, NSError * _Nullable error) {
//            DeLog(@"------error:%@",error);
//        }];
//    }
//
//    DeLog(@"------------%@",message.body);
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
